import {
  request
} from './request'

module.exports = {
  // 用户登录
  login: (data) => request('/user/login', 'POST', data),
  //获取店铺状态
  status: (data) => request('/shop/status', 'GET'),
  // 获取分类列表
  getCategoryList: (data) => request('/category/list', 'GET'),
  // 获取分类id获取菜品列表
  getDishList: (data) => request('/dish/list?categoryId=' + data, 'GET'),
  // 获取分类id获取套餐列表
  getSetmealList: (data) => request('/setmeal/list?categoryId=' + data, 'GET'),
  // 根据套餐id查询包含的菜品
  getDishBySetmealId: (data) => request('/setmeal/dish/' + data, 'GET'),


  // 获取用户购物车列表
  getShoppingCartList: (data) => request('/shoppingCart/list', 'GET'),
  // 添加菜品到购物车
  addShoppingCart: (data) => request('/shoppingCart/add', 'POST', data),
  // 减少购物车中的菜品数量
  subShoppingCart: (data) => request('/shoppingCart/sub', 'POST', data),
  // 清空购物车
  cleanShoppingCart: (data) => request('/shoppingCart/clean', 'DELETE'),


  // 查询用户默认地址
  getDefaultAddress: (data) => request('/addressBook/default', 'GET'),
  // 设置默认地址
  setDefaultAddress: (data) => request('/addressBook/default', 'PUT', data),
  // 查询用户所有地址
  getAddressList: (data) => request('/addressBook/list', 'GET'),
  // 新增地址
  addAddress: (data) => request('/addressBook', 'POST', data),
  // 根据id查询地址
  getAddressById: (data) => request('/addressBook/' + data, 'GET'),
  // 根据id删除地址
  deleteAddress: (data) => request('/addressBook/?id=' + data, 'DELETE'),
  // 根据id修改地址
  updataAddress: (data) => request('/addressBook', 'PUT', data),


  // 再来一单
  orderRepetition: (data) => request('/order/repetition/' + data, 'POST'),
  // 历史订单查询
  orderHistory: (data) => request('/order/historyOrders?page=' + data.page + '&pageSize=' + data.pageSize + '&status=' + data.status, 'GET'),
  // 取消订单
  orderCancel: (data) => request('/order/cancel/' + data, 'PUT'),
  // 查询订单详情
  orderDetail: (data) => request('/order/orderDetail/' + data, 'GET'),
  // 用户下单
  // 订单支付
  orderPayment: (data) => request('/order/payment', 'POST', data),
  // 删除订单
  deleteOrder: (data) => request('/order/delete/' + data, 'DELETE'),

  // 商家动态查询
  getTrendsList: (data) => request('/trends/page?page=' + data.page + '&pageSize=' + data.pageSize, 'GET'),
}